'''
 线索统计页面
'''
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
from tools.utils import get_table_text

from page.base_page import BasePage


class ClueCountPage(BasePage):
    # 定位器
    bumen_select_locator = (By.ID, 'department')
    yuangong_select_locator = (By.ID, 'role')
    sousuo_btn_locator = (By.CSS_SELECTOR, '#searchForm > ul > li:nth-child(4) > button')
    duanyan_table_locator=(By.CSS_SELECTOR,'#report_content > table > tbody')


    # 选择部门
    def xstj_xzbm(self):
        xzbm = self.driver.find_element(*self.bumen_select_locator)
        xzbm.click()
        Select(xzbm).select_by_index(1)

    # 选择员工
    def xstj_xzyg(self):
        xzyg = self.driver.find_element(*self.yuangong_select_locator)
        xzyg.click()
        Select(xzyg).select_by_index(1)


    # 点击搜索
    def xstj_sousuo(self):
        self.driver.find_element(*self.sousuo_btn_locator).click()

# 断言表格元素
    def xstj_duanyan_biaoge(self,hang,lie):
        table = self.driver.find_element(*self.duanyan_table_locator)
        dy = get_table_text(table,hang,lie)
        return dy